<?php
  include "ReaderXML.class.php";
  include "RenderLayerXML.class.php";
  include "RenderMapXML.class.php";
  $path = $_SERVER['PATH_INFO'];
  if($path != null){

    $path_param = spliti("/", $path);

    switch($path_param[1]) {
      case "layer" : $layer = new RenderLayerXML();
                     $layer->genFloodLayerXML();
                     break;
      case "map" :   $id = $path_param[2];
                     if($id == 1){
                        $xml = "http://maps.google.co.th/maps/ms?hl=en&ie=UTF8&source=embed&msa=0&output=georss&msid=108663478994178951894.000493178832cb5584dc0";
                        $icon = "http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/water.png";
                        $reference = "www.thaiflood.com";
                     }else if($id == 2){
                        $xml = "http://maps.google.com/maps/ms?hl=en&ie=UTF8&source=embed&msa=0&output=georss&msid=108663478994178951894.000493099c3cea1c38143";
                        $icon = "http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/shopping.png";
                        $reference = "www.thaiflood.com";
                     }else if($id == 3){
                        $xml = "http://maps.google.co.th/maps/ms?hl=en&ie=UTF8&msa=0&output=georss&msid=108663478994178951894.0004931805b4cbfbf5000";
                        $icon = "http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/hospitals.png";
                        $reference = "www.thaiflood.com";
                     }else if($id == 4){
                        $xml = "http://maps.google.com/maps/ms?ie=UTF8&hl=en&source=embed&msa=0&output=georss&msid=109261647619174335009.000492e56b7863b0ebfb7";
                        $icon = "http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/movies.png";
                        $reference = "www.thaiflood.com";
                     }else if($id == 5){
                        $xml = "http://maps.google.com/maps/ms?ie=UTF8&hl=th&msa=0&output=georss&msid=105963700385024613540.0004940c4671e6b760abc";
                        $icon = "http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/rangerstation.png";
                        $reference = "www.911thai.com";
                        //var_dump($xml);
                     }else if($id == 6){
                        $xml  = "http://maps.google.com/maps/ms?ie=UTF8&hl=th&msa=0&output=georss&msid=105963700385024613540.00049410db4463bca9eae";
                        $icon = "http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/shopping.png";
                        $reference = "www.911thai.com";
                        //var_dump($xml);
                     }else if($id == 7){
                        $xml  = "http://help.thaiflood.com/feed/?c=10";
                        $icon = "http://maps.gstatic.com/intl/th_ALL/mapfiles/ms/micons/caution.png";
                        $reference = "www.thaiflood.com";
                        //var_dump($xml);
                     }


                    //var_dump($xml);
                    //break;

                    $rssGMap = new ReaderXML($xml, $icon, $reference);

                    if($id == 7){
                      $result = $rssGMap->getReadUshahidiXML();
                    }else{
                      $result = $rssGMap->getReadXML();
                    }
                    $map = new RenderMapXML();
                    $map->genFloodMapXML($result);
                    break;

      default :      break;
    }
  }
?>